package com.cloud.weixin.project.controller;

import com.cloud.common.core.enums.AuthEnums;
import com.cloud.common.core.model.response.ApiResponses;
import com.cloud.common.core.model.supers.SuperController;
import com.cloud.common.security.annotation.PreAuth;
import com.cloud.weixin.project.service.ITestService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 测试接口 前端控制器
 * </p>
 *
 * @author Sam
 * @since 2020-12-27
 */
@Api(tags = {"测试接口"})
@RestController
@RequestMapping("/open/test")
public class TestRestController extends SuperController {

    @Value("${server.port}")
    private String port;
    @Autowired
    private ITestService testService;

    @PreAuth(AuthEnums.OPEN)
    @ApiOperation("分布式seata测试 扣减余额")
    @PostMapping("/seataReduceAmount")
    public ApiResponses<Void> seataReduceAmount() {
        testService.seataReduceAmount();
        return success();
    }

}

